{extend name="public:base" /}
{block name="content"}
<link rel="stylesheet" href="__CSS__/addcomon.css">
<!--<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css">-->

<style>
    input.error { border: 1px solid red; }
    label.error {
        font-weight: bold;
        color: #EA5200;
    }
</style>

<div class="row" style="padding:15px;">
    <div class="col-xs-12" id="vueApp">
        <form id="commentForm" action="{:url('editall')}" method="post">
            <div class="box">
            <div class="box-header" data-original-title="" style="height: 40px;">
                <h2><i class="glyphicon glyphicon-plus"></i>修改任务</h2>
            </div>
            <div class="add-box">
                <div class="box-left">
                    <div class="form-group">
                        <label>月份:</label>
                        <input type="text" name="date"  class="form-control"  value="{$date}" disabled>
                    </div>

                    {volist name="info" id="vo"}
                        <div class="form-group" >
                            <label>{$vo.rwlx_text}:</label>
                            <input type="hidden" name="{$vo.id}ids[]"  class="form-control" value="{$vo.id}" >
                            <input type="text"   name="{$vo.id}ids[]"  class="form-control" value="{$vo.renwu}">
                        </div>
                    {/volist}

                </div>
                <div class="btn-box">
                    <button type="submit" class="btn btn-color-o" id="submit">确定</button>
                    <button type="reset" class="btn btn-color-g">重置</button>
                </div>
            </div>
        </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="__STATIC__/validate/jquery.validate.min.js"></script>

<!--<script src="//cdn.bootcss.com/moment.js/2.18.1/locale/zh-cn.js"></script>-->
<!--<script type="text/javascript" src="//cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>-->

<!--<script type="text/javascript">-->
    <!--$(function () {-->
        <!--$('#datetimepicker4').datetimepicker({-->
            <!--format: 'YYYY-MM',-->
            <!--defaultDate : new Date()-->
        <!--});-->
    <!--});-->
<!--</script>-->

<script>
    $().ready(function() {

        $('#rwlx_id').change(function () {
            $('#depar_id').hide();
            $('#ygroup_id').hide();
            if( $('#rwlx_id').val() == 2 ){
                $('#ygroup_id').show();
            }
            if( $('#rwlx_id').val() == 3 ){
                $('#depar_id').show();
            }
        });

        // 在键盘按下并释放及提交后验证提交表单
        $("#commentForm").validate({
//            rules: {
////                rwlx_id:{ required : true},
////                date:   { required : true,date:true},
////                renwu[]:  { required : true,digits:true},
//            },
//            messages: {
////                rwlx_id: 	"选择任务类型",
////                date:       { required:"请输入日期",date:"日期格式错误"},
////                renwu[]:	    { required:"请输入任务",digits:"输入正整数"},
//            },
            submitHandler: function(form)
            {
                $.ajax({
                    type: "POST",
                    url:  "{:url('editall')}",
                    data: $(form).serialize(),
                    beforeSend:function(){
                        $('#submit').attr("disabled","false"); //禁止点击
                    },
                    success: function(msg){
                        console.log(msg);

                        if(msg.code==1){
                            $('#submit').attr("disabled","false"); //禁止点击
                            layer.msg(msg.msg, {icon: 1});
                            setTimeout(function(){
                                location.href=msg.url;
                            },3000); //延迟演示
                        }else{
                            layer.msg(msg.msg, {icon: 2});
                            $('#submit').removeAttr("disabled"); //禁止点击
                        }

                    }
                });
            }

        });
        return false;
    });
    highlight_subnav("{:url('index')}");
</script>
{/block}